package com.xiaoge.config;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConfigurationProperties(prefix = "spring.redis")
@ConditionalOnProperty(name = {"spring.redis.host"})
/**
 * 上面配置中的@ConditionalOnProperty(name = {"spring.redis.host"})
 * 如果只是单机的Redis则不需要添加该属性;
 * 但是为了后面一套代码兼容多个Redis部署模式, 使用该属性作为是否创建Bean的条件;
 * 如果是集群模式那么就不会使用spring.redis.host来作为连接字符串了;
 */
public class StandaloneRedisConfig {

    String host;

    int port;

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }
}
